import pandas as pd
import argparse
if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('file2', help='path to submission file')
    args = parser.parse_args()
    file2_path = args.file2

def compare(pred_path, labeled_path= '/root/code/tianchi/data/test/labeled.csv'):
    df1 = pd.read_csv(labeled_path)
    df2 = pd.read_csv(pred_path)
    merged_df = pd.merge(df1, df2, on='filename', suffixes=('_df1', '_df2'))

    # Check if predictions match
    merged_df['match'] = merged_df['result_df1'] == merged_df['result_df2']

    # Calculate accuracy
    accuracy = merged_df['match'].mean()

    print("Merged Dataframe:")
    print(merged_df)
    print("Accuracy:", accuracy)